@extends('admin._layouts.default')

@section('main')

      <div class="row-fluid ">
        <div class="span12 box gradient ">
      <div class="title">
            <div class="row-fluid">
                <h3>                <button onclick="window.location.href= '{{ route('admin.buyrecords.payment',array('month'=>$thismonth,'step'=>2)) }}';return false" class="btn btn-success btn-mini pull-right" style="margin:5px 5px 0 0">下月</button>
                <button onclick="window.location.href= '{{ route('admin.buyrecords.explode',array('month'=>$thismonth,'step'=>'payment')) }}';return false" class="btn btn-danger btn-mini pull-right" style="margin:5px 5px 0 0">导出{{ $thismonth }}</button>

                <button onclick="window.location.href= '{{ route('admin.buyrecords.payment',array('month'=>$thismonth,'step'=>1)) }}';return false" class="btn btn-primary btn-mini pull-right" style="margin:5px 5px 0 0">上月</button>
                  <i class=" icon-shopping-cart"></i> 微信付款{{ $thismonth }}
                </h3>
            </div>
        </div><!-- End .title -->
        <div class="content">

            <table id="datatable_in" class="responsive table table-striped" style="width:100%;margin-bottom:0; ">
              <thead>
               <tr>
                  <th>城市</th>
                 <th>直营商</th>
                  <th width="80">
                    <i class="icon-wechat"></i>昵称
                  </th>
                  <th>
                    收货姓名
                  </th>
                  <th>
                   联系方式
                  </th>
                 <th>
                   收货地址
                 </th>
                 <th>
                   <i class="icon-magic"></i>订单号
                  </th>
                 <th >
                    付款日期
                 </th>
                 <th>
                    付款金额
                 </th>
               </tr>
              </thead>
              <tbody>
              @foreach($buyrecords as $buyrecord)
               <tr>
               <td>{{ $buyrecord->customer->cityname->name }}</td>
               <td>{{ $buyrecord->customer->areaname->name }}</td>
                 <td>
                    {{ $buyrecord->customer->name }}
                  </td>
                  <td>
                    {{ $buyrecord->name }}
                 </td>
                 <td>
                    <i class=" icon-phone-sign"></i><strong>{{ $buyrecord->mobile }}</strong>
                 </td>
                 <td class="to_hide_phone">
                    <i class="  icon-home"></i> {{ $buyrecord->address }}
                  </td>
                  <td>
                    {{ $buyrecord->out_trade_no }}
                 </td>
                 <td>{{ date('Y-m-d H:i:s',$buyrecord->pay_time) }}</td>
                 <td>{{ $buyrecord->total_fee }}</td>
               </tr>
               @endforeach

               </tbody>
            </table>
                <div class="row-fluid control-group">

                    <div class="pagination pull-right ">
                        {{ $buyrecords->appends(array('month' => $pagemonth,'step'=>$step))->links() }}
                    </div>
                </div>
                <br/>


            </div>
        </div>
        <!-- End box -->
      </div>

@stop


@section('modals')


<div id="confirm_alert" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 class="modal-title" id="myModalLabel">确定本次操作吗？</h3>
      </div>
      <div class="modal-body">
        <i class=" icon-warning-sign color_red pull-left fs_24"></i>

        <p>一旦【确定】，本次操作不可撤销。</p>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary">确定</button>
      </div>
    </div>
  </div>
</div>
@stop


@section('script')
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/full-calendar/fullcalendar.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.peity.min.js') }}"></script>
<script type="text/javascript" language="javascript" src="{{ URL::asset('ad/js/plugins/datatables/js/jquery.dataTables.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/chosen/chosen/chosen.jquery.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/flot/jquery.flot.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.uniform.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/raphael.2.1.0.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/justgage.1.0.1.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/scripts.js') }}"></script>


    <script type="text/javascript" charset="utf-8">
    // Datatables
    $(document).ready(function() {
      var dontSort = [];
                $('#datatable_city thead th').each( function () {
                    if ( $(this).hasClass( 'no_sort' )) {
                        dontSort.push( { "bSortable": false } );
                    } else {
                        dontSort.push( null );
                    }
      } );
      $('#datatable_city').dataTable( {
        "sDom": "<'row table_top_bar'<'row-fluid'>'<'to_hide_phone'>'f'<'>r>t<'row'>",
         "sDom": "<'row table_top_bar'<'row-fluid'<'to_hide_phone' f>>><'row'>",
         "aaSorting": [[ 1, "asc" ]],
        "bPaginate": false,
        "bJQueryUI": false,
        "aoColumns": dontSort

      } );
      $.extend( $.fn.dataTableExt.oStdClasses, {
        "s`": "dataTables_wrapper form-inline"
      } );
    } );
    </script>
    <script>
    function check_order(id){

         if(confirm("确定吗？"))
         {
            $.post('{{ URL::route('admin.buyrecords.check_order') }}',{id:id},function(data){
                if(data == 1){
                    location.reload();
                }
            })
         }
    }
    </script>
@stop
